package com.restaurant.springboot.entity;

import javax.persistence.*;
import java.math.BigDecimal;
import java.util.Objects;

@Entity
@Table(name = "dishes", schema = "restaurant", catalog = "")
public class DishesEntity {

    private int id;
    private String name;
    private BigDecimal price;
    private String resume;
    private String photoUrl;
    private int state;
    private int saleNum;
    private int storeNum;
    private int dishesSeriesId;

    @Id
    @Column(name = "id")
    @GeneratedValue
    public int getId() {
        return id;
    }

    public void setId(int id) {
        this.id = id;
    }

    @Basic
    @Column(name = "name")
    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    @Basic
    @Column(name = "price")
    public BigDecimal getPrice() {
        return price;
    }

    public void setPrice(BigDecimal price) {
        this.price = price;
    }

    @Basic
    @Column(name = "resume")
    public String getResume() {
        return resume;
    }

    public void setResume(String resume) {
        this.resume = resume;
    }

    @Basic
    @Column(name = "photo_url")
    public String getPhotoUrl() {
        return photoUrl;
    }

    public void setPhotoUrl(String photoUrl) {
        this.photoUrl = photoUrl;
    }

    @Basic
    @Column(name = "state")
    public int getState() {
        return state;
    }

    public void setState(int state) {
        this.state = state;
    }

    @Basic
    @Column(name = "sale_num")
    public int getSaleNum() {
        return saleNum;
    }

    public void setSaleNum(int saleNum) {
        this.saleNum = saleNum;
    }

    @Basic
    @Column(name = "store_num")
    public int getStoreNum() {
        return storeNum;
    }

    public void setStoreNum(int storeNum) {
        this.storeNum = storeNum;
    }

    @Basic
    @Column(name = "dishes_series_id")
    public int getDishesSeriesId() {
        return dishesSeriesId;
    }

    public void setDishesSeriesId(int dishesSeriesId) {
        this.dishesSeriesId = dishesSeriesId;
    }

    @Override
    public boolean equals(Object o) {
        if (this == o) return true;
        if (o == null || getClass() != o.getClass()) return false;
        DishesEntity that = (DishesEntity) o;
        return id == that.id &&
                state == that.state &&
                saleNum == that.saleNum &&
                storeNum == that.storeNum &&
                dishesSeriesId == that.dishesSeriesId &&
                Objects.equals(name, that.name) &&
                Objects.equals(price, that.price) &&
                Objects.equals(resume, that.resume) &&
                Objects.equals(photoUrl, that.photoUrl);
    }

    @Override
    public int hashCode() {
        return Objects.hash(id, name, price, resume, photoUrl, state, saleNum, storeNum, dishesSeriesId);
    }
}
